package com.neuedu.his.dao;

import com.neuedu.his.entity.RoleMenu;
import com.neuedu.his.entity.UserRole;
import com.neuedu.util.JDBCUtil;

import java.util.List;

public class RoleMenuDao {


    /**
     * 根据角色id 查询菜单权限
     * @param id
     * @return
     */
    public List<RoleMenu> selectRoleMenu(Integer id){
        String sql = "select * from role_menu where role_id = ?";
        return JDBCUtil.executeQuery(sql,RoleMenu.class,id);
    }

    //delete from user_role where user_id = ?
    public boolean delete(String sql,String roleId){
        return JDBCUtil.executeUpdate(sql,roleId);
    }



    public boolean insert(RoleMenu roleMenu){
        String sql = "insert into role_menu(menu_id,role_id) values(?,?)";
        return JDBCUtil.executeUpdate(sql,roleMenu.getMenuId(),roleMenu.getRoleId());
    }
}
